#include "BspLed.h"


#define LED_RUN(X) X ? (GPIOA->BSRR = GPIO_Pin_3): (GPIOA->BRR = GPIO_Pin_3)


uint8_t LED_RUN_State = 0;  //运行指示灯保存状态寄存器

/******************************************************************************
* @brief  运行LED_RUN初始化
* @param  None
* @retval None
* @IO PA3--------LED_RUN
*******************************************************************************/
void BspLed_Init(void)
{
	GPIO_InitTypeDef GPIOX;
	
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA,ENABLE);
	GPIOX.GPIO_Pin = GPIO_Pin_3;
	GPIOX.GPIO_Mode = GPIO_Mode_Out_PP;
	GPIOX.GPIO_Speed = GPIO_Speed_50MHz;
	GPIO_Init(GPIOA,&GPIOX);
	LED_RUN_State = 0;
  LED_RUN(LED_RUN_State);
}

/******************************************************************************
* @brief  LED_RUN_On
* @param  None
* @retval None
* @IO None
*******************************************************************************/
void BspLed_RUN_On(void)
{
	LED_RUN_State = 1;
	LED_RUN(LED_RUN_State);
}

/******************************************************************************
* @brief  LED_RUN_Off
* @param  None
* @retval None
* @IO None
*******************************************************************************/
void BspLed_RUN_Off(void)
{
	LED_RUN_State = 0;
	LED_RUN(LED_RUN_State);
}

/******************************************************************************
* @brief  LED_RUN_Reverse
* @param  None
* @retval None
* @IO None
*******************************************************************************/
void BspLed_RUN_Reverse(void)
{
	if(LED_RUN_State)
		 LED_RUN_State = 0;
	else
		 LED_RUN_State = 1;
	LED_RUN(LED_RUN_State);
}






